<%@taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
<%@taglib prefix="c" uri="http://java.sun.com/jstl/core_rt"%>
<script type="text/javascript"
	src="<c:url  value='/resources/js/shop/jquery-1.7.2.min.js'></c:url>"></script>
<script type="text/javascript">
	function changeState(orderid,select){
		var state =select.options[select.selectedIndex].value;
		
		window.location = "/shopping-mall/changestate.html?id=" + orderid+ "&state="+ state;
		
	}
	
</script>
<div id="rightContent">
	<h2>List Orders</h2>
	<table id=ordertable class="table table-hover">
		<tr>
			<th>Order ID</th>
			<th>Customer</th>
			<th>Request Date</th>
			<th>State</th>
			<th>Action</th>
		</tr>
		<c:if test="${!empty listorder}">
			<c:forEach items="${listorder }" var="order">
			<input type="hidden" name="state" value="${order.id}">
				<tr>
					<td id="orderid"><c:out value="${order.id}" /></td>
					<td><c:out value="${order.fullname }"></c:out></td>
					<td><c:out value="${order.stringDate}"></c:out></td>
					<td><select id="state"  onchange="changeState(${order.id},this)">
							<option value="0"
								<c:if test="${order.state==0}"> selected="true"</c:if>>Pending</option>
							<option value="1"
								<c:if test="${order.state==1}"> selected="true"</c:if>>Completed</option>
							<option value="2"
								<c:if test="${order.state==2}"> selected="true"</c:if> >Cancel</option>
					</select> <br /></td>
					<td><a href="#"><img
							src="/shopping-mall/resources/images/shop/admin/save_icon.png"
							title="Save"></a> <a
						href="<c:url value="/orderdetail.html?id=${order.id}"/>"> <img
							src="/shopping-mall/resources/images/shop/admin/detail_icon.png"
							title="Details"></a>&nbsp;&nbsp;&nbsp;</td>
				</tr>
			</c:forEach>
		</c:if>
	</table>
</div>